package com.gray.wow.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.gray.wow.dao.FamilyDao;
import com.gray.wow.domain.Family;
import com.gray.wow.domain.FamilyVote;

@Repository("familyDao")
public class FamilyDaoImpl extends SqlSessionDaoSupport implements FamilyDao {

	@Override
	public int add(Family family) {
		return getSqlSession().insert("mybatis.mapper.FamilyMapper.insertFamily",
				family);

	}

	@Override
	public int update(Family family) {
		return getSqlSession().update("mybatis.mapper.FamilyMapper.updateFamily",
				family);

	}

	@Override
	public int delete(Map<String, Object> map) {
		return getSqlSession().delete("mybatis.mapper.FamilyMapper.deleteFamily", map);

	}

	@Override
	public List<Family> findListByCondition(Map<String, Object> map) {
		return getSqlSession().selectList(
				"mybatis.mapper.FamilyMapper.getFamily", map);
	}

	@Override
	public int findCountByCondition(Map<String, Object> map) {
		Object obj = getSqlSession().selectOne(
				"mybatis.mapper.FamilyMapper.getFamilyCount", map);
		return (Integer) (obj == null ? 0 : obj);
	}

	@Override
	public int insertFamilyVote(FamilyVote familyVote) {
		return getSqlSession().insert("mybatis.mapper.FamilyMapper.insertFamilyVote",
				familyVote);

	}

	@Override
	public int updateFamilyVote(FamilyVote familyVote) {
		return getSqlSession().update("mybatis.mapper.FamilyMapper.updateFamilyVote",
				familyVote);

	}

	@Override
	public int deleteFamilyVote(Map<String, Object> map) {
		return getSqlSession().delete("mybatis.mapper.FamilyMapper.deleteFamilyVote",
				map);

	}

	@Override
	public List<FamilyVote> getFamilyVote(Map<String, Object> map) {
		return getSqlSession().selectList(
				"mybatis.mapper.FamilyMapper.getFamilyVote", map);
	}

	@Override
	public int getFamilyVoteCount(Map<String, Object> map) {
		Object obj = getSqlSession().selectOne(
				"mybatis.mapper.FamilyMapper.getFamilyVoteCount", map);
		return (Integer) (obj == null ? 0 : obj);
	}

	@Override
	public int delete(Family t) {
		return 0;
		
	}

	@Override
	public int update(Map<String, Object> map) {
		return 0;
		
	}

}
